﻿{extend name="public:base" /}

{block name="css"}
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css"/>
<link href="__ADMIN__/css/style.css" rel="stylesheet">

<style>
    .layui-input-block {
        margin-left:0;
        min-height: 36px;
    }

    .layui-form-label {
        float: left;
        display: block;
        width: 80px;
        font-weight: 400;
        line-height: 20px;
        text-align: left;
        padding: 0;
    }

    .layui-form-checkbox i {
        position: absolute;
        right: 0;
        top: 0;
        width: 30px;
        height: 30px;
        border: 1px solid #d2d2d2;
        border-left: none;
        border-radius: 0 2px 2px 0;
        color: #fff;
        font-size: 20px;
        text-align: center;
    }

    .layui-form-checked i, .layui-form-checked:hover i {
        color: #5FB878;
    }

    .fairy-sku-table th, .fairy-sku-table td {
        text-align: center;
    }

    .layui-layer-btn0 {
        color: #fff !important;
    }
</style>
{/block}

{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="row search-form">
                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group">
                                <input placeholder="请输入用户名称" name="name" type="text" value="{:input('name')}" class="form-control form-control-lg">
                            </div>
                        </div>
                        <input  name="id" type="hidden" value="{:input('id')}" class="form-control form-control-lg">
                        <div class="col-sm-2 m-b-sm">
                            <div class="input-group">
                                <button type="button" class="btn btn-primary btn-lg screen-btn">搜索</button>
                            </div>
                        </div>
                    </div>
                    <form method="post" class="layui-form fairy-form">
                        <div class="layui-form fairy-form">
                            <!-- 用户 -->
                            <div class="layui-form-item">
                            <div class="layui-input-block">
                                    <div class="sku-list" style="width:1115px;height:450px;border: 1px solid #ccc;overflow: auto; padding: 10px">
                                        {volist name="user_list" id="vo"}
                                        <div style="float: left; width: 200px; margin-left: 15px">
                                            <input type="checkbox" name="user_id[]" title="{$vo['username']} / {$vo['mobile']}" class="fairy-sku-list" lay-filter="fairy-sku-list" value="{$vo['id']}">
                                            <div class="layui-unselect layui-form-checkbox layui-form-checked" style="width: 150px"><span>颜色</span><i class="layui-icon layui-icon-ok"></i></div>
                                        </div>

                                        {/volist}
                                    </div>
                                <div class="hr-line-dashed"></div>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$id}">
                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-default back-page">返回</button>
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">
                                    提交
                                </button>
                            </div>
                        </div>
                      </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{/block}

{block name='js'}
<script src="/static/layui/layui.js"></script>
<script src="/static/skuTable.js"></script>
<script type="text/javascript" src="__PLUG__/kindeditor/kindeditor-all.js"></script>

<!-- 实例化编辑器 && layUI select 处理 -->
<script>
    $('.screen-btn').click(function (){
        var start_time = $('input[name ="start_time"]').val();
        var end_time = $('input[name ="end_time"]').val();

        if(new Date(start_time) >= new Date(end_time) && (start_time != '' && end_time != '') ){
            layer.msg("请选择正确的时间段");
            return;
        }
        var url = "{:url(distributeCoupon)}";
        var query  = $('.search-form').find('input').serialize();
        var squery = $('.search-form').find('select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        squery=squery.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        squery=squery.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query+'&'+squery;
        }else{
            url += '?' + query+'&'+squery;
        }
        window.location.href = url;
    })
</script>
{/block}
